package com.suixinsanren.design.compound.study.demo01;

public class DuckSimulator {

    public static void main(String[] args) {
        DuckSimulator simulator = new DuckSimulator();
        simulator.simulator();
    }

    public void simulator() {
        MallardDuck mallardDuck = new MallardDuck();
        RedHeadDuck redHeadDuck = new RedHeadDuck();
        DuckCall duckCall = new DuckCall();
        RubberDuck rubberDuck = new RubberDuck();
        GooseAdapter goose = new GooseAdapter(new Goose());

        System.out.println("\nDuck Simulator");

        simulator(mallardDuck);
        simulator(redHeadDuck);
        simulator(duckCall);
        simulator(rubberDuck);
        simulator(goose);
    }

    public void simulator(Quackable duck) {
        duck.quack();
    }
}
